#!/bin/sh
# @Time    : 2020-12-17
# @Author  : TP
# @Name    : service_log_tailf.sh
# @Description  : 判断此次部署是否成功 并打印java日志

#项目日志文件路径
SERVICE_NAME=kc-admin
SERVICE_DIR=/home/opt/${SERVICE_NAME}

echo "执行shell脚本： service_log_kill_tailf.sh"
sh ${SERVICE_DIR}/service_log_kill_tailf.sh ${SERVICE_DIR} &

# 执行tailf 查看日志
echo "执行shell命令： tailf ${SERVICE_DIR}/console.log"
tailf ${SERVICE_DIR}/console.log

#echo "[tags] tailf 命令已经成功退出"
# 判断是否捕获到 Started .* second
sum=`cat ${SERVICE_DIR}/kc_app_started_log`
sum_jvm=`cat ${SERVICE_DIR}/kc_app_jvm_log`
if [ $sum -gt 0 ];then
 echo [tags] ------------
 echo [tags] 项目启动成功
 echo [tags] ------------
 rm -rf ${SERVICE_DIR}/console.log
elif [ $sum_jvm -gt 0 ];then
 echo [tags] ------------
 echo [tags] 项目启动成功
 echo [tags] ------------
 rm -rf ${SERVICE_DIR}/console.log
else
 echo [tags] ------------
 echo [tags] 项目启动失败
 echo [tags] ------------
fi